<%@ page contentType="text/html; charset=utf-8" language="java" 
import="java.sql.*" errorPage="" %>
<%@ page import="javax.jdo.PersistenceManager" %>
<%@ page import="javax.jdo.Query" %>
<%@ page import="java.util.List" %>
<%@ page import="shared.MyDateUtil" %>
<%@ page import="shared.PMF" %>
<%@ page import="activity.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>-Search Result-</title>
</head>
<body>
<p><strong>搜尋結果</strong></p>


<table border="1">
<%
PersistenceManager pm = PMF.get().getPersistenceManager();
String search = request.getParameter("search");
String textfield = request.getParameter("textfield");
//Query query = pm.newQuery(Activity_supply.class);


if(search != null){
	
	Query q = pm.newQuery("select from activity.Activity_supply where actShop_s =="+textfield);
	//List ids = (List) q.execute(textfield);
	//Query q = pm.newQuery(Activity_supply.class, "getActShop_s == \"Jones\" && age < age_limit");
	//q.declareParameters("double age_limit");
//List results = (List)q.execute(20.0);
try {
	List<Activity_supply> results = (List<Activity_supply>) q.execute();
%>
<tr><td>商家名稱</td><td>活動名稱</td><td>集點起始日</td><td>集點截止日</td><td>兌換起始日</td><td>兌換截止日</td><td>描述</td></tr>
<%
        for (Activity_supply act : results) {      	
        	if(textfield.equals(act.getActShop_s())){
%>				
				<tr>
				<td><%=act.getActID_s() %></td>
				<td><%=act.getActShop_s() %></td>
				<td><%=act.getActName_s() %></td>
				<td><%=act.getActPoint_s() %></td>
				<td><%=act.getActStart_s() %></td>
				<td><%=act.getActEnd_s() %></td>				
				<td><%=act.getActContent_s()%></td>
				</tr>
		
<% }
        }	   		
}//try
finally {
    q.closeAll();
		}
}
%>
</table>